
export default {
    components: {

    },
    data() {
        return {
            fileList: [

            ],
            //请求发布的各种选择
            ForAdoptiondata: [],
            trait: [],
            traits: '',
            category: '',
            gender: '',
            yimiao: '',
            quchong: '',
            jueyu: '',
            laiyuan: "",
            tixing: '',
            maofa: ''
        };
    },
    methods: {
        Addfeatures(value) {
            if (this.trait.length <= 3) {
                for (let key in this.trait) {
                    if (this.trait[key] == value) {
                        this.traits = value
                    }
                }
                if (this.trait.length < 3 && this.traits != value) {
                    this.trait.push(value)
                    console.log(this.trait);
                    this.traits = ''
                } else if (this.traits == value) {
                    for (let key in this.trait) {
                        if (this.trait[key] == value) {
                            this.trait.splice(key, 1)
                            console.log(this.trait);
                            this.traits = ''
                        }
                    }
                } else if (this.trait.length == 3) {
                    alert('最多选择3种类型！')
                }
            }
        },
        show(value) {
            for (let key in this.trait) {
                if (this.trait[key] == value) {
                    console.log(1);
                    return true
                }
                
            }
        },
    },
    created() {
        this.$axios({
            method: "GET",
            url: "/api/getadoptinfo",
        })
            .then(res => {
                console.log(res.data.data);
                this.ForAdoptiondata = res.data.data
            })
            .catch(err => {
                console.error(err)
            });

    }
}
